local spamList1 = {
   [1] = "呃朋友们好啊",
   [2] = "我是浑元形意太极门掌门人",
   [3] = "马保国",
   [4] = "刚才有个朋友问我马老师发生什么事了",
   [5] = "我说怎么回事",
   [6] = "给我发了几张截图",
   [7] = "我一看哦原来是昨天",
   [8] = "有两个年轻人",
   [9] = "三十多岁",
   [10] = "一个体重九十多公斤",
   [11] = "一个体重八十多公斤",
   [12] = "有一个说是我在健身房练功颈椎练坏了",
   [13] = "马老师你能不能教教我浑元功法",
   [14] = "帮助治疗一下",
   [15] = "我的颈椎病",
   [16] = "我说你在健身房练死劲儿",
   [17] = "他不服气",
   [18] = "你两个手来折我一个手指头",
   [19] = "他折不动",
   [20] = "他说你这个没用",
   [21] = "我说我这个有用",
   [22] = "这是化劲儿",
   [23] = "传统功夫是讲化劲儿的",
   [24] = "四两拨千斤",
   [25] = "二百多斤的英国大力士",
   [26] = "都握不动我这一个手指头啊",
   [27] = "他非要和我试试",
   [28] = "我说可以",
   [29] = "我一说完他啪就站起来了很快啊",
   [30] = "然后上来就是一个左正蹬",
   [31] = "吭",
   [32] = "一个右鞭腿",
   [33] = "一个左刺拳",
   [34] = "我全部防出去了啊",
   [35] = "防出去以后自然是传统功夫以点到为止",
   [36] = "右拳放到他鼻子上没打他",
   [37] = "我笑一下准备收拳",
   [38] = "因为这时间",
   [39] = "按传统功夫的点到为止他已经输了",
   [40] = "如果这一拳发力",
   [41] = "一拳就把他鼻子打骨折了",
   [42] = "放在鼻子上没有打他",
   [43] = "他也承认",
   [44] = "我先打到他面部",
   [45] = "他不知道拳放在他鼻子上",
   [46] = "他承认我先打到他面部",
   [47] = "我收拳的时间不打了",
   [48] = "他突然袭击",
   [49] = "左刺拳来打我脸",
   [50] = "啊我大意了啊",
   [51] = "没有闪",
   [52] = "他的左拳给我眼",
   [53] = "右眼蹭了一下",
   [54] = "但没关系啊",
   [55] = "他也说啊他截图也说了",
   [56] = "两分多钟以后当时流眼泪了",
   [57] = "捂着眼我说停停",
   [58] = "然后两分钟钟以后",
   [59] = "两分多钟以后诶就好啦",
   [60] = "我说小伙子你不讲武德你不懂",
   [61] = "我说马老师对不对不起",
   [62] = "我不懂规矩",
   [63] = "他说他是乱打的",
   [64] = "他可不是乱打的啊",
   [65] = "正蹬鞭腿左刺拳训练有素",
   [66] = "后来他说他练过三四年泰拳",
   [67] = "啊看来是有备而来",
   [68] = "这两个年轻人不讲武德",
   [69] = "来骗来偷袭",
   [70] = "我六十九岁的老同志",
   [71] = "这好吗这不好",
   [72] = "我劝这位年轻人",
   [73] = "耗子尾汁",
   [74] = "好好反思",
   [75] = "以后不要再犯这样的聪明",
   [76] = "小聪明啊",
   [77] = "武林要以和为贵",
   [78] = "要讲武德",
   [79] = "不要搞窝里斗",
   [80] = "谢谢朋友们"
}

local spamList2 = {
   [1] = "朋友们好",
   [2] = "今天和大家探讨一下",
   [3] = "怎样打",
   [4] = "松果糖豆闪电鞭",
   [5] = "要打出松果糖豆闪电鞭",
   [6] = "要做到三点",
   [7] = "一要做到全身真正的放松",
   [8] = "关节要放松",
   [9] = "但是关节周围的筋模",
   [10] = "要适当的隆起",
   [11] = "这里面",
   [12] = "该松的松该紧的紧",
   [13] = "松中有紧紧中有松",
   [14] = "这个问题非常复杂",
   [15] = "这里不多说",
   [16] = "在《尚济形意拳练法打法实践》一书中",
   [17] = "有详细的解释",
   [18] = "二要练好内功",
   [19] = "只有练好内功",
   [20] = "你才能丹田发力",
   [21] = "打出松果糖豆劲",
   [22] = "慢练这是健身的",
   [23] = "下颌上开",
   [24] = "上和下开",
   [25] = "所以你这个松果糖豆劲儿",
   [26] = "这个你看",
   [27] = "整个关节都在动啊",
   [28] = "是不是啊",
   [29] = "练好内功以后",
   [30] = "丹田发力",
   [31] = "你才能打出松果糖豆劲儿",
   [32] = "这是丹田的开和功",
   [33] = "上丹的开合",
   [34] = "中丹的开合",
   [35] = "下丹的开合",
   [36] = "丹田练好开合",
   [37] = "才能打出爆发力",
   [38] = "三要用三维立体浑元劲",
   [39] = "才能打出松果糖豆闪电鞭",
   [40] = "因为这个鞭子劲",
   [41] = "你看都是三位的",
   [42] = "下面我打一个连五鞭",
   [43] = "打了五鞭",
   [44] = "一鞭两鞭三鞭四鞭五鞭",
   [45] = "这五鞭要连着打",
   [46] = "你看这个实战性",
   [47] = "要动步实战性",
   [48] = "实战时间一定要动步",
   [49] = "全身松好",
   [50] = "用三维立体浑元劲",
   [51] = "才能打出脚气",
   [52] = "打出松果糖豆闪电鞭",
   [53] = "谢谢朋友门"
}

--thx to 逍遥 --
local spamList3 = {
   [1] = "呃朋友们好啊",
   [2] = "我是爱慕维尔红演门掌门人",
   [3] = "aw老师",
   [4] = "刚才有两个年轻人问我aw老师发生甚么事了",
   [5] = "我说怎么回事",
   [6] = "给我发了几张截图",
   [7] = "我一看",
   [8] = "哦!原来是昨天",
   [9] = "有两个陀螺",
   [10] = "一个2300一个邀请码",
   [11] = "一个20欧一个月",
   [12] = "有一个说是我在官匹摇头挨打",
   [13] = "aw老师能不能用你的红演",
   [14] = "帮助我治疗一下",
   [15] = "我摇头的手感",
   [16] = "我说你在官匹练摇头不好用",
   [17] = "他不服气",
   [18] = "你一把鸟狙来E我一个头",
   [19] = "他E不到",
   [20] = "他说你这个没用",
   [21] = "我说我这个有用",
   [22] = "这是凹凸",
   [23] = "传统开挂是讲凹凸的",
   [24] = "凹凸红演",
   [25] = "他非要和我试试",
   [26] = "我说可以",
   [27] = "他一听“啪”一下就转起来了！很快啊！",
   [28] = "然后上来就是一个道具",
   [29] = "吭",
   [30] = "一个抓抬头",
   [31] = "一个peek鸟狙",
   [32] = "我全部防出去了啊",
   [33] = "防出去以后自然是官匹开挂以点到为止",
   [34] = "鼠标放在凹凸上没有打开",
   [35] = "我笑一下准备收枪",
   [36] = "因为这时间",
   [37] = "按官匹的点到为止他已经输了",
   [38] = "如果凹凸打开",
   [39] = "一枪就把他穿死了",
   [40] = "鼠标放在凹凸上没有打开",
   [41] = "他也承认",
   [42] = "他先洗了下我的假身",
   [43] = "他不知道我鼠标放在凹凸开关上",
   [44] = "他也承认我先洗了下他的假身啊",
   [45] = "我收枪的时间不打了",
   [46] = "他突然袭击来",
   [47] = "鸟狙来E我头",
   [48] = "啊我大意了啊",
   [49] = "没有闪",
   [50] = "他的鸟狙给我头",
   [51] = "头蹭了一下",
   [52] = "但没关系啊",
   [53] = "他也说啊他截图也说了",
   [54] = "两分多钟以后当时流眼泪了",
   [55] = "捂着眼我说停停",
   [56] = "然后两分钟钟以后",
   [57] = "两分多钟以后诶就好啦",
   [58] = "我说小伙子你不讲武德你不懂",
   [59] = "他说对不起对不起aw老师",
   [60] = "我不懂规矩",
   [61] = "他说他是乱打的",
   [62] = "他可不是乱打的啊",
   [63] = "道具，卡点，蛤蟆，训练有素",
   [64] = "后来他说他打了三、四个月的办公室",
   [65] = "啊看来是有备而来",
   [66] = "这两个外挂不讲武德",
   [67] = "来骗来 来偷袭",
   [68] = "我报备的大公司",
   [69] = "这好吗这不好",
   [70] = "我劝艾丁和wish",
   [71] = "耗子尾汁",
   [72] = "好好反思",
   [73] = "以后不要再犯这样的聪明",
   [74] = "小聪明啊",
   [75] = "呃～办公室要以蛤为贵",
   [76] = "要讲武德",
   [77] = "不要搞窝里斗",
   [78] = "谢谢朋友们"
}


---UI Start---
screenX, screenY = draw.GetScreenSize()
local window = gui.Window("majiagongfu", "马家功夫 By Loyisa v1.41", screenX/4 , screenY/4 , 500, 500)
window:SetOpenKey(gui.GetValue("adv.menukey"))
local masterswitch = gui.Checkbox(window,"master","总开关",0);
---spam group
local spamgroup = gui.Groupbox(window, "松果糖豆刷屏器", 20, 50, 200, 200)
local spamcheckbox = gui.Checkbox(spamgroup, "spam.master", "马保国 Spam", 0)
spamcheckbox:SetDescription("Advertise MaBaoGuo in chat.")
---resolver group
local resolvergroup = gui.Groupbox(window, "浑元功法解析器", 20, 220, 200, 200)
local resolvercheckbox = gui.Checkbox(resolvergroup, "resolver.master", "浑元解析增强", 0)
resolvercheckbox:SetDescription("Use 浑元功法 to enchant ur resolver")
---killsay group
local killsaygroup = gui.Groupbox(window, "马家嘲讽", 20, 335, 200, 200)
local killsaycheckbox = gui.Checkbox(killsaygroup, "chaofeng.killsay", "KillSay", 0)
local diedsaycheckbox = gui.Checkbox(killsaygroup, "chaofeng.diedsay", "DiedSay", 0)
---AA group
---gui.Groupbox( parent, name, x, y, w, h )
local manualaagroup = gui.Groupbox( window , "三维立体手动AA", 240, 50, 240, 200 )
local maacheckbox = gui.Checkbox( manualaagroup, "manualaa.master", "启用", 0 )
local leftkey = gui.Keybox( manualaagroup, "manualaa.leftkey", "AA向左", 0 )
local leftfov = gui.Slider( manualaagroup, "manualaa.leftfov", "向左的角度", 90, 0, 180 )
local rightkey = gui.Keybox( manualaagroup, "manualaa.rightkey", "AA向右", 0 )
local rightfov = gui.Slider( manualaagroup, "manualaa.rightfov", "向右的角度", -90, -180, 0 )
local backkey = gui.Keybox( manualaagroup, "manualaa.backkey", "AA背身", 0 )
local backfov = gui.Slider( manualaagroup, "manualaa.backfov", "背身角度", 180, -180, 180 )
---UI End---



spamtype =
        gui.Combobox(
         spamgroup,
        "spam_type",
        "Spam Type",
        "武德",
        "松果糖豆闪电鞭",
        "AW老师")

---Dont Touch it
local lasttick = globals.TickCount()
local index = 1
local lasttype
local moduleswitch
local InGAME = client.GetPlayerNameByIndex(client.GetLocalPlayerIndex());

function mabaoguospam()
   ---总开关
   if (lasttype == nil) then
      lasttype = spamtype:GetValue()
   end
   if (lasttype ~= spamtype:GetValue()) then
      lasttype = spamtype:GetValue()
      index = 1
   end
   ---总开关
   if (masterswitch:GetValue() ~= true or spamcheckbox:GetValue() ~= true) then
      lasttick = globals.TickCount()
      return
   end
   ---是否在游戏里
   if (InGAME == nil) then
      return
   end
   if (spamtype:GetValue() == 0 ) then
      if globals.TickCount() - lasttick > 100 then
         local response = tostring(spamList1[index])
         client.ChatSay(response)
         lasttick = globals.TickCount()
         index = index + 1
         if index > 80 then
            index = 1
        end
     end
   end
   if (spamtype:GetValue() == 1 ) then
      if globals.TickCount() - lasttick > 100 then
         local response = tostring(spamList2[index])
         client.ChatSay(response)
         index = index + 1
         lasttick = globals.TickCount()
         if index > 53 then
            index = 1
         end
     end
   end
   if (spamtype:GetValue() == 2 ) then
      if globals.TickCount() - lasttick > 100 then
         local response = tostring(spamList3[index])
         client.ChatSay(response)
         index = index + 1
         lasttick = globals.TickCount()
         if index > 78 then
            index = 1
         end
     end
   end
end

local lasttick2 = globals.TickCount()

function baoguodeResolver()
   ---总开关
   if (masterswitch:GetValue() ~= true or resolvercheckbox:GetValue() ~= true) then
      lasttick2 = globals.TickCount()
      return
   end
   if globals.TickCount() - lasttick2 > 50 then
      gui.SetValue("rbot.hitscan.maxprocessingtime", math.random(5,75))
      lasttick2 = globals.TickCount()
   end
end

function CHAT_KillSay(Event)
   ---总开关
   if (masterswitch:GetValue() ~= true) then
      return
   end
   if (InGAME == nil) then
      return
   end
   if (Event:GetName() == "player_death") then
       local ME = client.GetLocalPlayerIndex()

       local INT_UID = Event:GetInt("userid")
       local INT_ATTACKER = Event:GetInt("attacker")

       local NAME_Victim = client.GetPlayerNameByUserID(INT_UID)
       local INDEX_Victim = client.GetPlayerIndexByUserID(INT_UID)

       local NAME_Attacker = client.GetPlayerNameByUserID(INT_ATTACKER)
       local INDEX_Attacker = client.GetPlayerIndexByUserID(INT_ATTACKER)

       if (INDEX_Attacker == ME and INDEX_Victim ~= ME and killsaycheckbox:GetValue() == true) then
           client.ChatSay("你这个没用，我这个有用（指蛤蟆和1伤害）")
       else if (INDEX_Victim == ME and INDEX_Attacker ~= ME and diedsaycheckbox:GetValue() == true) then
           client.ChatSay("年轻人不讲武德，来偷袭我69岁老aimware（指空枪和卡解析）")
       end
      end
   end
end

local oaayaw
local leftkeytoggle = false
local rightkeytoggle = false
local backkeytoggle = false
local aasetted = false

-- font
local f = draw.CreateFont("微软雅黑", 25 , 0)

local aasetted = false

function ManualAA()
   --判断是否开启rage
   if (gui.GetValue("rbot.master") ~= true) then
      return
   end
   --获取原来的AA数据
   if (oaayaw == nil) then
      oaayaw = gui.GetValue("rbot.antiaim.base")
   end
   --开关
   if ((masterswitch:GetValue() ~= true or maacheckbox:GetValue() ~= true) and aasetted == true) then
      gui.SetValue("rbot.antiaim.base", oaayaw )
      aasetted = false
   end
   if (masterswitch:GetValue() ~= true or maacheckbox:GetValue() ~= true) then
      return
   end
   if (InGAME == nil) then
      return
   end
   --设置角度
   if (leftkeytoggle) then
      gui.SetValue("rbot.antiaim.base", leftfov:GetValue() .. " \"Desync\"" )
      draw.SetFont(f)
      draw.Color(0,255,0,255);
      draw.TextShadow(screenX/2 - 62, screenY/2 + 50 , "你头在左边")
      aasetted = true
   end
   if (rightkeytoggle) then
      gui.SetValue("rbot.antiaim.base", rightfov:GetValue() .. " \"Desync\"" )
      draw.SetFont(f)
      draw.Color(0,255,0,255);
      draw.TextShadow(screenX/2 - 62, screenY/2 + 50, "你头在右边")
      aasetted = true
   end
   if (backkeytoggle) then
      gui.SetValue("rbot.antiaim.base", backfov:GetValue() .. " \"Desync\"" )
      draw.SetFont(f)
      draw.Color(0,255,0,255);
      draw.TextShadow(screenX/2 - 62, screenY/2 + 50, "你是背身的")
      aasetted = true
   end
   --处理按键
   if leftkey:GetValue() ~= 0 then
      if (input.IsButtonPressed(leftkey:GetValue()) and leftkeytoggle == false) then
         leftkeytoggle = true
         rightkeytoggle = false
         backkeytoggle = false
      else if (input.IsButtonPressed(leftkey:GetValue()) and leftkeytoggle == true ) then
         gui.SetValue("rbot.antiaim.base", oaayaw )
         leftkeytoggle = false
      end
      end
   end
   if rightkey:GetValue() ~= 0 then
      if (input.IsButtonPressed(rightkey:GetValue()) and rightkeytoggle == false) then
         rightkeytoggle = true
         leftkeytoggle = false
         backkeytoggle = false
      else if (input.IsButtonPressed(rightkey:GetValue()) and rightkeytoggle == true ) then
         gui.SetValue("rbot.antiaim.base", oaayaw )
         rightkeytoggle = false
      end
      end
   end
   if backkey:GetValue() ~= 0 then
      if (input.IsButtonPressed(backkey:GetValue()) and backkeytoggle == false) then
         backkeytoggle = true
         leftkeytoggle = false
         rightkeytoggle = false
      else if (input.IsButtonPressed(backkey:GetValue()) and backkeytoggle == true ) then
         gui.SetValue("rbot.antiaim.base", oaayaw )
         backkeytoggle = false
      end
      end
   end
end

client.AllowListener( 'player_death' );

callbacks.Register("Draw", "mabaoguo", mabaoguospam )
callbacks.Register( "Draw", "betterResolver", baoguodeResolver );
callbacks.Register( "Draw", "ManualAA", ManualAA )
callbacks.Register( 'FireGameEvent', 'AWKS', CHAT_KillSay);
